/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.suypower.carManage.action;

import com.jarp.db.DAO;
import com.opensymphony.xwork2.ActionSupport;
import com.suypower.carManage.comm.ConstUtil;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.servlet.ServletException;

/**
 *
 * @author zhaoyuan
 */
public class ChangeMenuAction extends ActionSupport{
    
    private String item;
    private String menu;
    DAO dao = new DAO();
    
    @Override
    public String execute() {
        String res = ERROR;
        String sql = String.format("UPDATE tb_access SET pid = %s WHERE id = %s", menu,item);
        try {
            int count = dao.execCommand(ConstUtil.DBNAME, sql);
            if(count > 0){
                res = SUCCESS;
            }
        } catch (ServletException ex) {
            Logger.getLogger(ChangeMenuAction.class.getName()).log(Level.SEVERE, null, ex);
        }
        return res;
    }

    public String getItem() {
        return item;
    }

    public void setItem(String item) {
        this.item = item;
    }

    public String getMenu() {
        return menu;
    }

    public void setMenu(String menu) {
        this.menu = menu;
    }
    
    
}
